package com.zjy.dto;

import com.zjy.api.Api;

import java.io.Serializable;

/**
 * Created by Administrator on 2019/2/27.
 * 接口返回格式
 */
public class ApiResult implements Serializable {
    private static final long serialVersionUID = 1L;

    protected int code = Api.SUCCESS;
    protected String msg = "请求成功";
    private Object data;

    public <R> R error(int code, String msg) {
        this.code = code;
        this.msg = msg;
        return (R) this;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
